export const sessionSet = (key, value) => {
  if (!sessionStorage) {
    return;
  }
  if (key != null && value != null) {
    sessionStorage.setItem(key, value);
  }
};
export const sessionGet = (key) => {
  if (!sessionStorage) {
    return null;
  }
  if (key == null) {
    return null;
  }
  return sessionStorage.getItem(key);
};
export const sessionSetJSON = (key, jsonValue) => {
  if (jsonValue != null) {
    sessionSet(key, JSON.stringify(jsonValue));
  }
};
export const sessionGetJSON = (key) => {
  const value = sessionGet(key);
  if (value != null) {
    return JSON.parse(value);
  }
};
export const sessionRemove = (key) => {
  sessionStorage.removeItem(key);
};

export const localSet = (key, value) => {
  if (!localStorage) {
    return;
  }
  if (key != null && value != null) {
    localStorage.setItem(key, value);
  }
};
export const localGet = (key) => {
  if (!localStorage) {
    return null;
  }
  if (key == null) {
    return null;
  }
  return localStorage.getItem(key);
};
export const localSetJSON = (key, jsonValue) => {
  if (jsonValue != null) {
    localSet(key, JSON.stringify(jsonValue));
  }
};
export const localGetJSON = (key) => {
  const value = localGet(key);
  if (value != null) {
    return JSON.parse(value);
  }
};
export const localRemove = (key) => {
  localStorage.removeItem(key);
};
